@extends('admin.author.layout.layout')
@section('content')

<div class="row">
    <div class="col-lg-12">
    <script type="text/javascript" charset="utf-8" src="/public/uedit/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/public/uedit/ueditor.all.min.js"> </script>
    <script type="text/javascript" charset="utf-8" src="/public/udit/lang/zh-cn/zh-cn.js"></script>
        <div class="panel panel-default">
            <div class="panel-heading">
                文章发布
            </div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-lg-8 col-lg-offset-2">
                     @if (count($errors) > 0)
                        <div class="alert alert-danger">
                            <ul>
                                @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                    @endif
                        <form role="form" method="post" action="{{url('/admin/article/insert')}}">
                            <div class="form-group">
                                <label>所属书籍</label>
                                <select class="form-control" name='bid'>
                                    @foreach($books as $k=>$v)
                                        <option value="{{$v->id}}">{{$v->b_name}}</option>
                                    @endforeach
                                </select>
                            </div>
                            <div class="form-group">
                                <label>文章标题</label>
                                <input class="form-control" name="title">
                            </div>
                            
                            <div class="form-group">
                                <label>文章内容</label>
                                <textarea id="content" name="content"></textarea>
                            </div>
                            
                            <div class="form-group">
                                <label>是否收费章节</label>
                                <label class="radio-inline">
                                    <input type="radio" name="isfree" id="optionsRadiosInline1" value="0" checked="">否
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" name="isfree" id="optionsRadiosInline2" value="1">是
                                </label>
                            </div>
                            {{csrf_field()}}
                            <button type="submit" class="btn btn-primary btn-block">添加文章</button>
                        </form>
                    </div>
                    <script type="text/javascript">
                        //实例化编辑器,设定显示的按钮
                        //var ue = UE.getEditor('content');
                        UE.getEditor('content',{initialFrameHeight:500,initialFrameWidth:660,toolbars:[
                            ['bold','italic', 'underline', 'fontborder', 'backcolor','indent']
                        ]});
                    </script>
                </div>
                <!-- /.row (nested) -->
            </div>
            <!-- /.panel-body -->
        </div>
        <!-- /.panel -->
    </div>
    <!-- /.col-lg-12 -->
</div>

@endsection